package org.come.Jpanel;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.*;

import com.updateNew.MyIsif;
import org.come.until.CutButtonImage;

import com.tool.tcpimg.UIUtils;



public class DreamlandTrialModelJpanel extends JPanel {

    private JLabel labImg, labNum;
    private int type;//0已通过 1未通过 2未解锁

    public DreamlandTrialModelJpanel() {
        if ("水墨UI".equals(MyIsif.getStyle())) {
            setPreferredSize(new Dimension(313, 43));
            setOpaque(false);
            setLayout(null);
            getLabNum();
            getLabImg();
        } else {
            setPreferredSize(new Dimension(227, 43));
            setOpaque(false);
            setLayout(null);
            getLabNum();
            getLabImg();
        }
    }

    /**
     * 修改面板
     */
    public void changeShow(int type) {
        this.type = type;
        if (type == 0) {
            labImg.setForeground(Color.green);
            labImg.setText("已完成");
            labNum.setText("1");
        } else if (type == 1) {
            labImg.setForeground(Color.red);
            labImg.setText("未完成");
            labNum.setText("0");
        } else if (type == 2) {
            labImg.setForeground(Color.gray);
            labImg.setText("未解锁");
            labNum.setText("0");
        }

    }

//    private ImageIcon iconPass;


    //已完成坐标
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
    }

    public JLabel getLabImg() {
        if ("水墨UI".equals(MyIsif.getStyle())) {

            if (labImg == null) {
                labImg = new JLabel();
//            幻境完成度显示
                labImg.setBounds(93, 13, 60, 14);
                labImg.setFont(UIUtils.TEXT_FONT);
                this.add(labImg);
            }
        } else {

            if (labImg == null) {
                labImg = new JLabel();
//            幻境完成度显示
                labImg.setBounds(90, 26, 60, 14);
                labImg.setFont(UIUtils.TEXT_FONT);
                this.add(labImg);
            }
        }
        return labImg;
    }

    public void setLabImg(JLabel labImg) {
        this.labImg = labImg;
    }

    public JLabel getLabNum() {
        if ("水墨UI".equals(MyIsif.getStyle())) {

            if (labNum == null) {
                labNum = new JLabel("1", SwingConstants.CENTER);
                labNum.setForeground(Color.white);
                labNum.setFont(UIUtils.TEXT_FONT1);
//            幻境完成次数显示
                labNum.setBounds(177, 13, 29, 17);
                this.add(labNum);
            }
        } else {

            if (labNum == null) {
                labNum = new JLabel("1", SwingConstants.CENTER);
                labNum.setForeground(Color.white);
                labNum.setFont(UIUtils.TEXT_FONT1);
//            幻境完成次数显示
                labNum.setBounds(165, 26, 29, 17);
                this.add(labNum);
            }
        }
        return labNum;
    }

    public void setLabNum(JLabel labNum) {
        this.labNum = labNum;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }


}
